<?php
session_start(); 
require_once('../include/connect.inc.php');
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Model Test Program</title>
<link rel="stylesheet" type="text/css" href="../template/template_style_wood.css">
</head>

<body>
<div id="menu"><div><img src="../images/icon-m.png" /></div>
<div id="menulinks">
		<a href="../person.php">จัดการบุคลากร</a>
		<a  href="../problem/admin_resive.php">ตรวจสอบความคิดเห็น</a>
        <a class="active" href="manage_news.php">ประกาศข่าวสาร</a>
        <a href="../logout.php">ออกจากระบบ</a>
		</div></div>
        
      <div id="p3">    
<div id="header"></div>
<div id="page"><div id="p1">คุณ<?php echo"$admin_name";?><hr />
<form id="form2" method="post" action="add_news.php">
<table  border="0" cellspacing="0" cellpadding="0">
      <tr>
        <th align="left"> จัดการข้อมูลข่าวสาร</th>
        <th align="right"><a href="add_news.php"><img src="../images/add.png" border="0" /></a></th>
      </tr>
    </table>
<table id="table" border="0" >
          <tr>
          <th align="center">ลำดับ</th>
            <th align="center">วันที่</th>
            <th align="center" >หัวข้อข่าวฝากประกาศ</th>
            <th align="center">ลบ</th>
            <th align="center" >แก้ไข</th>
          </tr>
          <tr>
           	<?php
				$query = query("SELECT * FROM tb_news order  by news_id DESC");
				$count=1;
					while ($rs = fetch_array($query)) 
				{
		   				$news_id = $rs['news_id'];
						$news_topic = $rs['news_topic'];
						$news_detail = $rs['news_detail'];
						$news_date = $rs['news_date'];
			?>
            <td align="center"><?php echo $count; echo ".";?></td>
           	<td align="center"><?php echo $news_date;?></td>
             <td>
             <a href="show_news.php?news_id=<?php echo $news_id;?>" target="_blank"><? echo $news_topic;?></a></td>
            <td align="center">
            <a href="del_news.php?del_id=<?=$news_id;?>"><img src="../images/delete1.png" border="0" onclick="return confirm('คุณต้องการลบข่าวสาร?')" /></a>
            <td align="center">
            <a href="edit_news.php?news_id=<?php echo $news_id;?>"><img src="../images/edit.png" alt="" border="0" /></a></td>
          		</tr>
                <? $count++; }?>
   	    </table>
           </form>
    </div>
    </div>
<div id="footer"></div>
</div>
</body>
</html>
